package com.sqx.modules.goods.controller.app;

import com.sqx.common.annotation.SysLog;
import com.sqx.common.utils.Result;
import com.sqx.modules.goods.entity.GoodsSku;
import com.sqx.modules.goods.service.GoodsSkuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description：TODO
 * @author： qiao
 * @create： 2024/10/9 15:36
 */
@RestController
@RequestMapping("/app/goodsSku/")
@Api(value = "商品规格相关-用户端",tags = {"商品规格相关-用户端"})
public class AppGoodsSkuController {

    @Autowired
    private GoodsSkuService goodsSkuService;

    @PostMapping("saveGoodsSku")
    @SysLog(value = "新增或修改商品规格",type = "1")
    @ApiOperation("新增或修改商品规格")
    public Result saveGoodsSku(@ApiParam("商品规格实体") GoodsSku goodsSku) {
        return goodsSkuService.saveGoodsSku(goodsSku);
    }

    @PostMapping("deleteGoodsSku")
    @ApiOperation("删除商品规格")
    @SysLog(value = "删除商品规格",type = "1")
    public Result deleteGoodsSku(@ApiParam("商品规格实体id")Long id) {
        return goodsSkuService.deleteGoodsSku(id);
    }

    @GetMapping("selectGoodsSku")
    @ApiOperation("查询商品规格")
    public Result selectGoodsSku(@ApiParam("商品规格实体id")Long id) {
        return goodsSkuService.selectGoodsSku(id);
    }

    @GetMapping("selectGoodsSkuList")
    @ApiOperation("查询商品规格列表")
    public Result selectGoodsSkuList(@ApiParam("页码")Integer page,
                                     @ApiParam("条数")Integer limit,
                                     @ApiParam("商品规格实体")GoodsSku goodsSku) {
        return Result.success().put("data",goodsSkuService.selectGoodsSkuList(page, limit, goodsSku));
    }
}
